#!/usr/bin/env python3

import xarray as xr
import numpy as np
import os

def diff(f1, f2):
	diff = f1.vor - f2.vor
	print('vor:', float(np.min(diff)), float(np.max(diff)))
	diff = f1.pt - f2.pt
	print('pt: ', float(np.min(diff)), float(np.max(diff)))
	diff = f1.u - f2.u
	print('u: ', float(np.min(diff)), float(np.max(diff)))
	diff = f1.v - f2.v
	print('v: ', float(np.min(diff)), float(np.max(diff)))
	diff = f1.phs - f2.phs
	print('phs: ', float(np.min(diff)), float(np.max(diff)))

f1 = xr.open_dataset('mz.p1.360x180x30.h0.nc')

file_path = 'mz.p1x2.360x180x30.h0.nc'
if os.path.isfile(file_path):
  f2 = xr.open_dataset(file_path)
  diff(f1, f2)

file_path = 'mz.p2x1.360x180x30.h0.nc'
if os.path.isfile(file_path):
  f2 = xr.open_dataset(file_path)
  diff(f1, f2)

file_path = 'mz.p2x2.360x180x30.h0.nc'
if os.path.isfile(file_path):
  f2 = xr.open_dataset(file_path)
  diff(f1, f2)

file_path = 'mz.p1x3.360x180x30.h0.nc'
if os.path.isfile(file_path):
  f2 = xr.open_dataset(file_path)
  diff(f1, f2)

file_path = 'mz.p1x6.360x180x30.h0.nc'
if os.path.isfile(file_path):
  f2 = xr.open_dataset(file_path)
  diff(f1, f2)

file_path = 'mz.p1x30.360x180x30.h0.nc'
if os.path.isfile(file_path):
  f2 = xr.open_dataset(file_path)
  diff(f1, f2)
